package com.matt.malltinylombok.example;

import lombok.*;

/**
 * EqualsAndHashCodeExample
 * Created by jiachun.lu on 2025/02/10.
 */
@Getter
@Setter
@EqualsAndHashCode
@AllArgsConstructor
@RequiredArgsConstructor(staticName = "of")
public class EqualsAndHashCodeExample {
    @NonNull
    private Long id;
    @EqualsAndHashCode.Exclude
    private String name;
    @EqualsAndHashCode.Exclude
    private Integer age;

    public static void main(String[] args) {
        EqualsAndHashCodeExample example1 = new EqualsAndHashCodeExample(1L, "test", 20);
        EqualsAndHashCodeExample example2 = new EqualsAndHashCodeExample(1L, "test", 30);
        EqualsAndHashCodeExample example3 = new EqualsAndHashCodeExample(1L);
        System.out.println(example1.equals(example2));
    }

}
